package com.letoken.platform.repo.app.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.letoken.platform.repo.app.po.VideoCommentRepliesClosure;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface VideoCommentRepliesClosureMapper extends BaseMapper<VideoCommentRepliesClosure> {


    @Select("select * from video_comment_replies_closure where descendant_id = #{descendant_id}")
    List<VideoCommentRepliesClosure> selectAllByDescendantId(Integer descendant_id);


    @Insert({"<script>",
            "insert into " +
            "video_comment_replies_closure(ancestor_id,descendant_id,depth) " +
            "values " +
            "<foreach collection='list' item='closure' separator=','> " +
            "  (#{closure.ancestorId} ,#{closure.descendantId},#{closure.depth}) " +
            "</foreach>",
            "</script>"})
    void insertAll(List<VideoCommentRepliesClosure> list);
}
